<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui" locale="#{localeBean.locale}">

	<h:head />
	<h:body>
		<ui:composition template="/pages/template/layout.xhtml">
			<ui:define name="content">
				<p:panel styleClass="register">

					<h:panelGroup layout="block" styleClass="">
						<p:messages id="msgs" showDetail="true" />
					</h:panelGroup>

					<h:form id="registerForm">
						<h:panelGroup layout="block" styleClass="info-form">

							<p:spacer width="100%" height="10" />

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['name']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:inputText value="#{userBean.operator.person.name}" required="true">
										<f:validateLength minimum="4" maximum="12" />
										<f:validateRequired />
									</p:inputText>
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['surname']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:inputText value="#{userBean.operator.person.surname}" required="true" />
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['birthdate']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:calendar value="#{userBean.operator.person.birthDate}" yearRange="c-100:c" navigator="true" display="inline" required="true" />
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['email']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:inputText value="#{userBean.operator.person.email}" required="true">
										<f:validateLength minimum="6" />
										<f:validateRequired />
									</p:inputText>
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['phoneNumber']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:inputText value="#{userBean.operator.person.phoneNumber}" required="true" />
								</h:panelGroup>
							</h:panelGroup>

							<p:spacer width="100%" height="20" />

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['username']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:inputText value="#{userBean.operator.username}" required="true">
										<f:validateLength minimum="4" maximum="16" />
										<f:validateRequired />
									</p:inputText>
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['password']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:password id="pwd1" value="#{userBean.operator.password}" match="pwd2" required="true">
										<f:validateLength minimum="4" maximum="16" />
										<f:validateRequired />
									</p:password>
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup layout="block" styleClass="form-item">
								<h:panelGroup layout="block" styleClass="label">
									<h:outputLabel value="#{i18n['password']}:" />
								</h:panelGroup>
								<h:panelGroup layout="block" styleClass="field">
									<p:password id="pwd2" value="#{userBean.operator.password}" required="true">
										<f:validateLength minimum="4" maximum="16" />
										<f:validateRequired />
									</p:password>
								</h:panelGroup>
							</h:panelGroup>

						</h:panelGroup>

						<p:spacer width="100%" height="10" />

						<h:panelGroup layout="block" styleClass="form-item">
							<p:commandButton styleClass="button" value="#{i18n['next']}" action="#{userBean.doRegister}" ajax="false">
								<f:setPropertyActionListener target="#{stationBean.registeredOperatorUsername}" value="#{userBean.operator.username}" />
							</p:commandButton>
						</h:panelGroup>

						<p:spacer width="100%" height="20" />

					</h:form>
				</p:panel>
			</ui:define>
		</ui:composition>
	</h:body>

</f:view>